class TransportistasController < ApplicationController
  # GET /transportista
  # GET /transportista.json
  def index
    @transportistas = Transportista.all

    respond_to do |format|
      format.html # index.html.erb
      #format.json { render json: @transportistas }
    end
  end

  # GET /transportista/1
  # GET /transportista/1.json
  def show
    @transportista = Transportista.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      #format.json { render json: @transportista }
    end
  end

  # GET /transportista/new
  # GET /transportista/new.json
  def new
    @transportista = Transportista.new

    respond_to do |format|
      format.html # new.html.erb
      #format.json { render json: @transportista }
    end
  end

  # GET /transportista/1/edit
  def edit
    @transportista = Transportista.find(params[:id])
  end

  # POST /transportista
  # POST /transportista.json
  def create
    @transportista = Transportista.new(params[:transportista])

    respond_to do |format|
      if @transportista.save
        format.html { redirect_to transportistas_path, :notice=> 'transportista was successfully created.' }
       # format.json { render json: @transportista, status: :created, location: @transportista }
      else
        format.html { render :action=> "new" }
        #format.json { render json: @transportista.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /transportista/1
  # PUT /transportista/1.json
  def update
    @transportista = Transportista.find(params[:id])

    respond_to do |format|
      if @transportista.update_attributes(params[:transportista])
        format.html { redirect_to transportistas_path, :notice=> 'transportista was successfully updated.' }
        #format.json { head :no_content }
      else
        format.html { render :action=> "edit" }
        #format.json { render json: @transportista.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /transportista/1
  # DELETE /transportista/1.json
  def destroy
    @transportista = Transportista.find(params[:id])
    @transportista.destroy

    respond_to do |format|
      format.html { redirect_to transportistas_url }
      #format.json { head :no_content }
    end
  end
end
